﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;

namespace NetOrientDB.ObjectModel
{
	public class OrientProperty
	{
		public int Id { get; set; }
		public string Name { get; set; }
		public string Type { get; set; }
		public string LinkedType { get; set; }
		public string LinkedClass { get; set; }
		public bool Mandatory { get; set; }
		public bool NotNull { get; set; }
		public bool Indexed { get; set; }

		public OrientProperty() { }
		public OrientProperty(JObject jObj)
		{
			this.Parse(jObj);
		}

		public void Parse(JObject jObj)
		{
			this.Id = jObj.Value<int>("id");
			this.Name = jObj.Value<string>("name");
			this.Type = jObj.Value<string>("type");
			this.LinkedType = jObj.Value<string>("linkedType");
			this.LinkedClass = jObj.Value<string>("linkedClass");
			this.Mandatory = jObj.Value<bool>("mandatory");
			this.NotNull = jObj.Value<bool>("notNull");
			this.Indexed = jObj.Value<bool>("indexed");
		}
		public override string ToString()
		{
			return this.Name;
		}
	}
}
